{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "from bs4 import BeautifulSoup as BS\n",
    "import re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "r = requests.get(\"https://www.qidian.com/finish?action=hidden&orderId=3&vip=1&sign=1&style=2&pageSize=50&siteid=1&pubflag=0&hiddenField=2&page=1\")\n",
    "resp = r.text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "soup = BS(resp,\"lxml\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<tr> <th>类别</th> <th>小说书名</th> <th>最新章节</th> <th>字数</th> <th>小说作者</th> <th class=\"right\">更新时间</th> </tr>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#思考正则表达式提取数据的策略\n",
    "soup.tr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "pat = re.compile('\\W')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "类别\n",
      "小说书名\n",
      "最新章节\n",
      "字数\n",
      "小说作者\n",
      "更新时间\n"
     ]
    }
   ],
   "source": [
    "for th in soup.tr.find_all(\"th\"):\n",
    "    print(th.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' 类别 小说书名 最新章节 字数 小说作者 更新时间 '"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "soup.tr.text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bs4.element.Tag"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(soup.tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bs4.element.ResultSet"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(soup.tr.find_all(\"th\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bs4.element.Tag"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(th)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 「游戏·虚拟网游」 从零开始 第23卷 第六章放飞希望（完结篇） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞹𘟀𘞺𘟂𘞿𘞾𘞽万 雷云风暴 2016-03-21 \n",
      " 「仙侠·幻想修仙」 修神外传 探花新书《修神外传仙界篇》已经上传 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘞽𘞷𘞷𘞿𘟁𘞻万 小段探花 2016-10-09 \n",
      " 「玄幻·东方玄幻」 移动藏经阁 番外，普林星系篇（2） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘞹𘞻𘞺𘞿𘞹𘞻万 汉宝 2018-08-02 \n",
      " 「玄幻·东方玄幻」 武神空间 完本感言！读者请进！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘞺𘞻𘞷𘞿𘟀𘞷万 傅啸尘 2016-09-17 \n",
      " 「玄幻·异世大陆」 异世傲天 第1878~1882【大结局！】 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘞺𘟀𘞼𘞿𘞹𘞾万 傲月长空 2018-01-15 \n",
      " 「科幻·未来世界」 修真四万年 新书预告结束和开始 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘟀𘞼𘟀𘞿𘞹𘞹万 卧牛真人 2018-08-31 \n",
      " 「玄幻·异世大陆」 剑神重生 完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞺𘟀𘞺𘞺𘞿𘞺𘞻万 天雷猪 2014-06-01 \n",
      " 「游戏·虚拟网游」 网游之倒行逆施 完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟂𘟂𘞼𘞿𘞷𘞻万 张扬的五月 2018-04-30 \n",
      " 「都市·都市生活」 左道旁门 后记 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟂𘞷𘞷𘞿𘞻𘞷万 velver 2015-12-22 \n",
      " 「仙侠·幻想修仙」 百炼成仙 幻雨新书《厨道仙途》，大家请去看看哦！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟂𘟁𘞷𘞿𘞻万 幻雨 2015-05-26 \n",
      " 「都市·娱乐明星」 恋战星梦 第二百章恋战星梦 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟂𘞺𘞻𘞿𘟂𘞹万 韩错 2015-06-01 \n",
      " 「玄幻·异世大陆」 枪魔霸世 《后记》 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟂𘟀𘞹𘞿𘞹𘞾万 狼牙怪兽 2014-11-30 \n",
      " 「科幻·时空穿梭」 武侠世界大穿越 完本感言以及新书 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞷𘟂𘞷𘞿𘞻𘟂万 我叫排云掌 2018-08-04 \n",
      " 「都市·都市生活」 美梦时代 新书《重生之最强人生》已上传，请诸兄多多指教！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞷𘞹𘞺𘞿𘞻𘞹万 俊秀才 2016-08-16 \n",
      " 「游戏·虚拟网游」 埃提亚 完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞷𘟀𘟂𘞿𘞻万 上帝不在天堂 2015-07-09 \n",
      " 「历史·两晋隋唐」 唐朝小闲人 新书已发：原始大厨王！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞷𘟀𘞹𘞿𘞺𘞹万 南希北庆 2018-09-03 \n",
      " 「仙侠·修真文明」 九炼归仙 《九炼归仙》完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞷𘞷𘞿𘞾𘞾万 博耀 2018-02-05 \n",
      " 「都市·娱乐明星」 大艺术家 新书上传 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘟁𘟁𘞿𘞹𘞺万 七七家d猫猫 2013-11-15 \n",
      " 「都市·都市生活」 极品小农场 新书《悠闲乡村直播间》已上架求首订 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘟁𘞻𘞿𘞷𘞷万 名窑 2017-12-27 \n",
      " 「玄幻·异世大陆」 满愿石 第五章坍塌（节五） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘟁𘞻𘞿𘟁𘟂万 扎姆卡特 2016-12-13 \n",
      " 「仙侠·幻想修仙」 真仙奇缘 完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞻𘟁𘞿𘟀𘞼万 默闻勋勋 2014-03-27 \n",
      " 「仙侠·幻想修仙」 仙欲逍遥 诚心道歉，望各位书友原谅。 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞻𘞺𘞿𘞻𘟁万 马一角 2014-07-23 \n",
      " 「仙侠·幻想修仙」 凡人修仙传 忘语新书《玄界之门》 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞼𘞼𘞿𘟁𘞽万 忘语 2016-01-05 \n",
      " 「玄幻·东方玄幻」 剑道独神 新群号 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞾𘞼𘞿𘞹𘞹万 六道沉沦 2016-01-19 \n",
      " 「历史·两宋元明」 北宋小厨师 开新书啦！开新书啦！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞺𘞷𘞿𘞻𘞻万 南希北庆 2015-06-19 \n",
      " 「军事·战争幻想」 佣兵的战争 9.18号新书发布，敬请关注。 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘞺𘞼𘞿𘟂𘞺万 如水意 2017-09-26 \n",
      " 「仙侠·现代修真」 最强弃少 新书《天下第九》 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘟁𘟀𘞼𘞿𘞺𘟂万 鹅是老五 2015-11-30 \n",
      " 「仙侠·幻想修仙」 飞天 新书《道君》正式发布 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟂𘞷𘞿𘞹𘟁万 跃千愁 2017-02-28 \n",
      " 「历史·两晋隋唐」 隋末阴雄 完本感言 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟂𘞹𘞿𘟂𘞻万 指云笑天道1 2017-08-09 \n",
      " 「历史·两宋元明」 风花醉 第1405章大结局 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟂𘞹𘞿𘞺𘞼万 少穿的内裤 2018-05-14 \n",
      " 「都市·异术超能」 都市之最强纨绔 最后再说几句 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟂𘞺𘞿𘞺𘞽万 左耳思念 2016-08-04 \n",
      " 「玄幻·东方玄幻」 光明纪元 完本感言！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞷𘟁𘞿𘟁𘟁万 血红 2014-01-16 \n",
      " 「游戏·游戏异界」 重生之恶魔猎人 终章：烟花灿烂 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞷𘞽𘞿𘞷𘞺万 颓废龙 2015-01-05 \n",
      " 「都市·娱乐明星」 韩娱之天王 新书已发，求支持 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟁𘟁𘞿𘟂𘞼万 呓语痴人 2014-06-27 \n",
      " 「历史·架空历史」 大魏宫廷 关于新书 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟁𘞼𘞿𘞻𘞷万 贱宗首席弟子 2018-08-06 \n",
      " 「历史·外国历史」 燃烧的莫斯科 第一千七百二十二章最后的胜利（大结局） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟁𘞼万 红场唐人 2017-08-09 \n",
      " 「科幻·未来世界」 随身带着星际争霸 请把推荐票投给《大支配者》，另重述下本书结局的事。 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟁𘞺𘞿𘞽𘞾万 暴兵对A 2018-06-04 \n",
      " 「都市·都市生活」 重生之财源滚滚 新书发布了！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘟁𘟀𘞿𘟁𘞻万 老鹰吃小鸡 2018-05-07 \n",
      " 「玄幻·东方玄幻」 武极天下 蚕茧新书，《真武世界》 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞻𘟂𘞿𘞷𘞷万 蚕茧里的牛 2015-09-07 \n",
      " 「都市·异术超能」 很纯很暧昧 第两千三百八十四章T17番外特别章（4） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞻𘞷𘞿𘞾𘞽万 鱼人二代 2013-05-08 \n",
      " 「玄幻·东方玄幻」 超级修炼系统 完本了！！！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞻𘞹𘞿𘞹𘞻万 包租东 2018-01-08 \n",
      " 「玄幻·东方玄幻」 完美世界 我的新书《圣墟》已上传 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞽𘟁𘞿𘞻𘞻万 辰东 2016-11-07 \n",
      " 「仙侠·幻想修仙」 仙逆 第十三卷 灯火阑珊第2088章蓦然回首（结局） @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞽𘞺𘞿𘞼𘞼万 耳根 2015-10-03 \n",
      " 「科幻·时空穿梭」 异世界的魔王大人 后记 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞼𘞺𘞿𘞻𘞼万 开心小帅 2017-05-15 \n",
      " 「仙侠·幻想修仙」 大器宗 新书《御灵真仙》已经上传，望周知 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞼𘞺𘞿𘞼𘞼万 不问苍生问鬼神 2016-11-08 \n",
      " 「历史·秦汉三国」 大汉帝国风云录 新书公告和大汉结束语 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞾𘞾𘞿𘞻𘟂万 猛子 2008-03-28 \n",
      " 「仙侠·修真文明」 遮天 我的新书《圣墟》已上传 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞾𘞹𘞿𘞾𘞺万 辰东 2013-06-30 \n",
      " 「玄幻·异世大陆」 无尽丹田 新书《天道图书馆》已经200万字了，已肥可宰！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞾𘟀𘞿𘟁𘞹万 横扫天涯 2016-07-01 \n",
      " 「科幻·末世危机」 末世魔神游戏 完本感言及新书 @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞾𘟀𘞿𘞼𘟁万 石闻 2015-07-20 \n",
      " 「都市·都市生活」 崛起美利坚 第1959章来吧！大结局！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞹𘞽𘞿𘟀𘞹万 虎躯巨震 2018-07-20 \n"
     ]
    }
   ],
   "source": [
    "for tr in soup.tbody.find_all('tr'):\n",
    "    print(tr.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tr.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\" 「都市·都市生活」 崛起美利坚 第1959章来吧！大结局！ @font-face { font-family: sKhvkPBl; src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/sKhvkPBl.ttf') format('truetype'); } .sKhvkPBl { font-family: 'sKhvkPBl' !important;     display: initial !important; color: inherit !important; vertical-align: initial !important; }𘞻𘞹𘞽𘞿𘟀𘞹万 虎躯巨震 2018-07-20 \""
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tr.text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<re.Match object; span=(0, 1), match=' '>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#解决正则表达式的问题tr.text是一个str\n",
    "pat.match(tr.text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#还要解决动态反爬字体的问题"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
